package com.iims.project.vo.query;

import com.iims.common.utils.SecurityUtils;
import com.iims.common.vo.GroupSearchBase;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 分组工作令搜索
 * 范围（全部、我的、本部门的）、业务类别、执行状态、时间 [产品类别]
 *
 * @author fanpei
 * @date 2021/7/14 17:14
 */
@ApiModel("分组工作令搜索参数")
@Data
public class GroupWorkTokenSearchQuery extends GroupSearchBase {

    @ApiModelProperty(value = "数据范围搜索:显示和值来源于字典数据business_common_searchDeptScopeData", required = true)
    private int scopeValue = -1;

    @ApiModelProperty(value = "业务类别搜索:显示和值来源于字典数据business_common_searchBusinessType", required = true)
    private int businessType = -1;

    @ApiModelProperty(value = "执行状态:显示和值来源于字典数据business_token_searchExeStatus", required = true)
    private int exeStatus = -1;

    @Override
    public void initCurrentUser() {
        if (scopeValue == 0) {
            currentUser = SecurityUtils.getLoginUser().getUser().getUser_code();
        }

        if (scopeValue == 1) {
            currentDept = SecurityUtils.getLoginUser().getUser().getDeptId();
        }
    }
}
